/*Confidential and Proprietary, Subject to the Non-Disclosure Agreement,
Version 1.0, between the Development Gateway Foundation, Inc and the
Recipient Copyright 2001-2004 Development Gateway Foundation, Inc.

Local Projects Database
*/
package ro.gateway.aida.db;

/**
 * @author Mihai Postelnicu
 * e-mail: mihai@ro-gateway.org
 */
public abstract class DBConnector {

	protected String name;
	protected String user;
	protected String password;
	protected String host;
	protected int port;
	
	
	/**
	 * @return Returns the iP.
	 */
	public String getHost() {
		return host;
	}
	/**
	 * @param ip The iP to set.
	 */
	public void setHost(String ip) {
		host = ip;
	}
	/**
	 * @return Returns the port.
	 */
	public int getPort() {
		return port;
	}
	/**
	 * @param port The port to set.
	 */
	public void setPort(int port) {
		this.port = port;
	}
	public abstract String createURL();
	

	public abstract String driverName();
		
	/**
	 * @return Returns the name.
	 */
	public String getName() {
		return name;
	}
	/**
	 * @param name The name to set.
	 */
	public void setName(String name) {
		this.name = name;
	}
	/**
	 * @return Returns the password.
	 */
	public String getPassword() {
		return password;
	}
	/**
	 * @param password The password to set.
	 */
	public void setPassword(String password) {
		this.password = password;
	}
	/**
	 * @return Returns the user.
	 */
	public String getUser() {
		return user;
	}
	/**
	 * @param user The user to set.
	 */
	public void setUser(String user) {
		this.user = user;
	}
	
	public String getDriverClass() {
	    if (this instanceof OracleDBConnector)
	    return ((OracleDBConnector)this).getDriverClass();
	    if (this instanceof PostgresDBConnector)
		    return ((PostgresDBConnector)this).getDriverClass();
	    return DRIVER;
	}
	
	public static final String DRIVER="undefined!";
			
}
